<template>
	<view>
		<view v-if="true">
			<view v-if="userInfo.states != 0">
				<view class="cu-list menu card-menu margin-top">
					<view class="cu-item">
						<view class="head cu-avatar radius">
							封禁
						</view>
						<view class="content text">
							<view style="width: 410rpx;">

								<view class="cu-tag round sm">封禁用户</view>
								<view class="cu-tag round sm">UID：{{userInfo.id}}</view>
							</view>
							<view class="text-gray text-sm flex text-a">
								<text class="text-cut">你的账号已被封禁！</text>
							</view>
						</view>
					</view>
				</view>
			</view>
			<view bindtap="getUserProfile" class="cu-list menu card-menu margin-top" v-else>
				<view class="cu-item">
					<!-- <view wx:if="{{userInfo.avatarUrl}}" class="head cu-avatar radius">
                  <image class="login" src="{{userInfo.avatarUrl}}"></image>
              </view> -->
					<view class="head cu-avatar radius">
						<image class="login" src="https://v2.api-m.com/api/head?return=302"></image>
					</view>
					<view class="content text">
						<view style="width: 410rpx;">
							<view class="text-black text-bold name">
								<text>微信用户</text>
							</view>
							<view class="cu-tag round bg-blue sm" v-if="userInfo.isVip == 0">普通用户</view>
							<view class="cu-tag round bg-red sm" v-else>VIP用户</view>
							<view class="cu-tag round bg-orange sm">UID：{{userInfo.id}}</view>
						</view>
						<view>
							<view class="text-gray text-sm flex text-a" v-if="userInfo.isVip == 0">
								<text class="text-cut">剩余解析次数：{{userInfo.syNumber}}</text>
							</view>
							<view class="text-gray text-sm flex text-a" v-else>
								<text class="text-cut">会员有效期：{{userInfo.dqTime}}</text>
							</view>
						</view>
						<!-- <view class="text-gray text-sm flex text-a" wx:else>
						<text class="text-cut">欢迎使用{{app_name}}~</text>
					</view> -->

					</view>
				</view>
			</view>
		</view>

		<view class="cu-list menu card-menu margin-top" v-else>
			<view class="cu-item">
				<view class="head cu-avatar radius">
					<image class="login" src="/images/132.jpg"></image>
				</view>
				<view class="content text">
					<view>
						<view class="text-black text-bold name">
							<view><button bindgetuserinfo="updateUserInfo" openType="getUserInfo"
									class="cu-tag round bg-orange jiexibut">点击登陆</button></view>
						</view>
						<view class="cu-tag round bg-blue sm">未登录用户</view>
					</view>
					<view class="text-gray text-sm flex text-a">
						<text class="text-cut">请登录后使用本程序</text>
					</view>
				</view>
			</view>
		</view>

		<view class="cu-list menu  card-menu margin-top">
			<view class="cu-list grid col-4 no-border">
				<view @click="toUrl('/pages/recommend/md5')" class="cu-item">
					<view class="cuIcon-video text-blue"></view>
					<text>视频标识</text>
				</view>
				<view @click="toUrl('/pages/recommend/invite')" class="cu-item">
					<view class="cuIcon-friend text-green"></view>
					<text>邀请列表</text>
				</view>
				<view @click="toUrl('/pages/recommend/help')" class="cu-item">
					<view class="cuIcon-edit text-orange"></view>
					<text>使用教程</text>
				</view>
				<view @click="no()" class="cu-item" data-target="Image">
					<view class="cuIcon-qr_code text-purple">
						<view class="cu-tag badge"></view>
					</view>
					<text>分享海报</text>
				</view>
			</view>
		</view>

		<view class="cu-list menu sm-border card-menu margin-top">
			<view @click="toUrl('/pages/task/keypay')" class="cu-item arrow">
				<view class="content">
					<text class="cuIcon-ticket text-orange"></text>
					<text class="text-grey">卡密兑换</text>
				</view>
			</view>
			<button  open-type="contact" class="cu-item arrow">
				<view style="text-align: left;" class="content">
					<text class="cuIcon-service text-olive"></text>
					<text class="text-grey">联系客服</text>
				</view>
			</button>
			<view @click="ql()" class="cu-item arrow">
				<view class="content">
					<text class="cuIcon-settings text-blue"></text>
					<text class="text-grey">清理缓存</text>
				</view>
			</view>
			<view class="cu-item arrow">
				<view class="content">
					<text class="cuIcon-vip text-yellow"></text>
					<text class="text-grey">会员免广告：{{userInfo.isVip==1?'已开启':'已关闭'}}</text>
				</view>
			</view>
		</view>
		<!-- <view class="cu-modal  {{modalName=='Image'?'show':''}}">
		<view class="cu-dialog">
			<view class="bg-img" mode="aspectFill" style="background-image:url({{admire_img}});height:380px;">
				<view class="cu-bar justify-end text-white">
					<view bindtap="hidezs" class="action text-grey">
						<text class="cuIcon-close"></text>
					</view>
				</view>
			</view>
			<view class="cu-bar bg-white">
				<view bindtap="hidezs" class="action margin-0 flex-sub solid-left">{{admire_title}}</view>
			</view>
		</view>
	</view> -->
	<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	import {
		getUserInfo
	} from "@/api/api.js"
	import config from '@/config'

	export default {
		data() {
			return {
				sysConfig: uni.getStorageSync("appUser"),
				userInfo: null
			}
		},
		onShow() {
			getUserInfo({
				userId: this.sysConfig.userId
			}).then(response => {
				this.userInfo = response.data
			})
		},
		methods: {
			toUrl(url) {
				this.$tab.navigateTo(url)
			},
			no(){
				this.$refs.uToast.show({
					type: 'success',
					title: '',
					message: "敬请期待 ",
					icon: false
				})
			},
			ql(){
				this.$refs.uToast.show({
					type: 'success',
					title: '',
					message: "清理成功 ",
					icon: false
				})
			}
		}
	}
</script>

<style lang="scss">
	button::after {
		border: none;
	}
	.head {
		border-radius: 16rpx !important;
		display: flex;
		height: 135rpx;
		margin: 25rpx 0;
		overflow: hidden;
		width: 145rpx;
	}

	.text {
		margin-left: 30rpx;
	}

	.text-a {
		margin-top: 10rpx;
	}

	.name {
		font-size: 35rpx;
		text-overflow: ellipsis;
		white-space: nowrap;
	}

	.ad,
	.name {
		overflow: hidden;
	}

	.ad {
		border-radius: 15rpx;
		margin: 30rpx 30rpx 30rpx;
	}

	.login {
		border-radius: 16rpx !important;
		display: flex;
		height: 135rpx;
		margin: 25rpx 0;
		overflow: hidden;
		width: 145rpx;
	}
</style>